//
//  myOrderTableVc.m
//  爱鲜蜂(郭少乾)
//
//  Created by GuoDeJin on 2016/11/20.
//  Copyright © 2016年 GuoDeJin. All rights reserved.
//

#import "myOrderTableVc.h"
#import "AXFIndentStatusController.h"

static NSString *ordCell = @"orderCellID";
@interface myOrderTableVc ()

@end

@implementation myOrderTableVc

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    
    //xib注册
    [self.tableView registerNib:[UINib nibWithNibName:@"BQMyOrderCell" bundle:nil] forCellReuseIdentifier:@"orderCellID"];
    
    
    self.navigationItem.title = @"我的订单";
    //自定义导航条返回按钮
    UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"v2_goback"] style:UIBarButtonItemStylePlain target:self action:@selector(buttonOF:)];
    //导航条颜色
    [self.navigationController.navigationBar setBarTintColor: [UIColor whiteColor]];
    
    self.navigationItem.leftBarButtonItem = barButtonItem;  
    
}

//pop回去
- (void)buttonOF:(UIBarButtonItem *)batBtn{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}


//视图将要被移除   显示tabbar
- (void)viewWillDisappear:(BOOL)animated{
    
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = NO;
    
    
}
//视图将要显示  隐藏tabbar
- (void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    
    self.tabBarController.tabBar.hidden = YES;
    
}



#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 5;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ordCell forIndexPath:indexPath];
    
    //设置cell的估计高度
    self.tableView.estimatedRowHeight = 140;
    //设置cell间距
    self.tableView.sectionHeaderHeight = 1.5;
    //设置cell最顶端的间距
    self.tableView.contentInset = UIEdgeInsetsMake(27, 0, 0, 0);
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    AXFIndentStatusController *IndentVc = [[AXFIndentStatusController alloc]init];
    
    [self.navigationController pushViewController:IndentVc animated:YES];
}

//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//    //手抬起 取消cell的选中状态
//    [tableView deselectRowAtIndexPath:indexPath animated:NO];
//}


/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
